import re

# test1
# string = 'Python is the best development language in the world 123456789 000'
# print(len(string))
# result = re.match('^Python\s\D{2}\s\D{3}\s\D{4}\s\D{11}\s\D{8}\s\D{2}\s\D{3}\s\D{5}\s\d{0,9}\s.*0$', string)
# print(result)
# print(result.group())  # 匹配结果
# print(result.span())  # 匹配长度

# test2  用.*的方式泛匹配
# string = 'Python is the best development language in the world 123456789 000'
# result = re.match('^Python.*000$', string)
# print(result.group())

# test3 精确匹配目标,用一个()或多个()括起来,第一个用group(1)输出,第二个用group(2)输出,依次类推
# string = 'Python is the best development language in the world 123456789 000'
# result = re.match('^P.*\s(\d+)\s.*0$', string)  # 123456789
# result = re.match('^P.*(\d+).*0$', string)  # 0
# result = re.match('^P.*?(\d+).*0$', string)  # 123456789
# print(result.group(1))

# test4  , re.S
# string = 'Python is the best 123456789 development ' \
#          'language in the world 000'
# result = re.match('^P.*?(\d+).*?000$', string)
# print(result.group(1))
# # print(result)


